package com.jr.service.impl;

import com.jr.dao.InvoicingRecordDao;
import com.jr.dao.impl.InvoicingRecordDaoImpl;
import com.jr.entity.InvoicingRecord;
import com.jr.service.InvoicingRecordService;

import java.util.List;

/**
 * @program:(invoice)
 * @author:Mr.Jin
 * @Date:(2023/2/25)
 */
public class InvoicingRecordServiceImpl implements InvoicingRecordService {
    private InvoicingRecordDao invoicingRecordDao = new InvoicingRecordDaoImpl();
    @Override
    public int addInvoice(InvoicingRecord invoicingRecord) throws Exception {

        return invoicingRecordDao.addInvoice(invoicingRecord);
    }

    @Override
    public int deleteInvoice() throws Exception {
        return invoicingRecordDao.deleteInvoice();
    }

    /**
     * 主页展示发票信息
     * @param enterpriseId
     * @return
     * @throws Exception
     */
    @Override
    public List<InvoicingRecord> allInvoiceMessage(Integer enterpriseId) throws Exception {
        return invoicingRecordDao.allInvoiceMessage(enterpriseId);
    }

    /**
     * 根据发票id进行退票,将状态修改为已作废
     * @param invoiceId
     * @return
     * @throws Exception
     */
    @Override
    public int refundTicket(Integer invoiceId) throws Exception {
        return invoicingRecordDao.refundTicket(invoiceId);
    }
}
